Optimal. Leaf size=228 \[ -\frac{b \left (a^2 A-4 a b B+3 A b^2\right )}{2 d \left (a^2-b^2\right )^2 (a+b \sin (c+d x))}+\frac{b^2 \left (-3 a^2 B+4 a A b-b^2 B\right ) \log (a+b \sin (c+d x))}{d \left (a^2-b^2\right )^3}-\frac{\sec ^2(c+d x) (-(a A-b B) \sin (c+d x)-a B+A b)}{2 d \left (a^2-b^2\right ) (a+b \sin (c+d x))}-\frac{(a A+3 A b+2 b B) \log (1-\sin (c+d x))}{4 d (a+b)^3}+\frac{(a A-3 A b+2 b B) \log (\sin (c+d x)+1)}{4 d (a-b)^3} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.326292, antiderivative size = 228, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.097, Rules used = {2837, 823, 801} \[ -\frac{b \left (a^2 A-4 a b B+3 A b^2\right )}{2 d \left (a^2-b^2\right )^2 (a+b \sin (c+d x))}+\frac{b^2 \left (-3 a^2 B+4 a A b-b^2 B\right ) \log (a+b \sin (c+d x))}{d \left (a^2-b^2\right )^3}-\frac{\sec ^2(c+d x) (-(a A-b B) \sin (c+d x)-a B+A b)}{2 d \left (a^2-b^2\right ) (a+b \sin (c+d x))}-\frac{(a A+3 A b+2 b B) \log (1-\sin (c+d x))}{4 d (a+b)^3}+\frac{(a A-3 A b+2 b B) \log (\sin (c+d x)+1)}{4 d (a-b)^3} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2837
Rule 823
Rule 801
Rubi steps
\begin{align*} \int \frac{\sec ^3(c+d x) (A+B \sin (c+d x))}{(a+b \sin (c+d x))^2} \, dx &=\frac{b^3 \operatorname{Subst}\left (\int \frac{A+\frac{B x}{b}}{(a+x)^2 \left (b^2-x^2\right )^2} \, dx,x,b \sin (c+d x)\right )}{d}\\ &=-\frac{\sec ^2(c+d x) (A b-a B-(a A-b B) \sin (c+d x))}{2 \left (a^2-b^2\right ) d (a+b \sin (c+d x))}-\frac{b \operatorname{Subst}\left (\int \frac{-a^2 A+3 A b^2-2 a b B-2 (a A-b B) x}{(a+x)^2 \left (b^2-x^2\right )} \, dx,x,b \sin (c+d x)\right )}{2 \left (a^2-b^2\right ) d}\\ &=-\frac{\sec ^2(c+d x) (A b-a B-(a A-b B) \sin (c+d x))}{2 \left (a^2-b^2\right ) d (a+b \sin (c+d x))}-\frac{b \operatorname{Subst}\left (\int \left (-\frac{(a-b) (a A+3 A b+2 b B)}{2 b (a+b)^2 (b-x)}+\frac{-a^2 A-3 A b^2+4 a b B}{\left (a^2-b^2\right ) (a+x)^2}+\frac{2 b \left (-4 a A b+3 a^2 B+b^2 B\right )}{\left (-a^2+b^2\right )^2 (a+x)}-\frac{(a+b) (a A-3 A b+2 b B)}{2 (a-b)^2 b (b+x)}\right ) \, dx,x,b \sin (c+d x)\right )}{2 \left (a^2-b^2\right ) d}\\ &=-\frac{(a A+3 A b+2 b B) \log (1-\sin (c+d x))}{4 (a+b)^3 d}+\frac{(a A-3 A b+2 b B) \log (1+\sin (c+d x))}{4 (a-b)^3 d}+\frac{b^2 \left (4 a A b-3 a^2 B-b^2 B\right ) \log (a+b \sin (c+d x))}{\left (a^2-b^2\right )^3 d}-\frac{b \left (a^2 A+3 A b^2-4 a b B\right )}{2 \left (a^2-b^2\right )^2 d (a+b \sin (c+d x))}-\frac{\sec ^2(c+d x) (A b-a B-(a A-b B) \sin (c+d x))}{2 \left (a^2-b^2\right ) d (a+b \sin (c+d x))}\\ \end{align*}
Mathematica [A] time = 1.64412, size = 246, normalized size = 1.08 \[ \frac{b \left (a^2 A-4 a b B+3 A b^2\right ) \left (\frac{1}{\left (a^2-b^2\right ) (a+b \sin (c+d x))}-\frac{\log (1-\sin (c+d x))}{2 b (a+b)^2}+\frac{\log (\sin (c+d x)+1)}{2 b (a-b)^2}-\frac{2 a \log (a+b \sin (c+d x))}{(a-b)^2 (a+b)^2}\right )+\frac{(a A-b B) ((a-b) \log (1-\sin (c+d x))-(a+b) \log (\sin (c+d x)+1)+2 b \log (a+b \sin (c+d x)))}{(a-b) (a+b)}+\frac{\sec ^2(c+d x) ((b B-a A) \sin (c+d x)-a B+A b)}{a+b \sin (c+d x)}}{2 d \left (b^2-a^2\right )} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.17, size = 388, normalized size = 1.7 \begin{align*} -{\frac{A{b}^{3}}{d \left ( a+b \right ) ^{2} \left ( a-b \right ) ^{2} \left ( a+b\sin \left ( dx+c \right ) \right ) }}+{\frac{a{b}^{2}B}{d \left ( a+b \right ) ^{2} \left ( a-b \right ) ^{2} \left ( a+b\sin \left ( dx+c \right ) \right ) }}+4\,{\frac{{b}^{3}\ln \left ( a+b\sin \left ( dx+c \right ) \right ) Aa}{d \left ( a+b \right ) ^{3} \left ( a-b \right ) ^{3}}}-3\,{\frac{{b}^{2}\ln \left ( a+b\sin \left ( dx+c \right ) \right ) B{a}^{2}}{d \left ( a+b \right ) ^{3} \left ( a-b \right ) ^{3}}}-{\frac{{b}^{4}\ln \left ( a+b\sin \left ( dx+c \right ) \right ) B}{d \left ( a+b \right ) ^{3} \left ( a-b \right ) ^{3}}}-{\frac{A}{4\,d \left ( a+b \right ) ^{2} \left ( \sin \left ( dx+c \right ) -1 \right ) }}-{\frac{B}{4\,d \left ( a+b \right ) ^{2} \left ( \sin \left ( dx+c \right ) -1 \right ) }}-{\frac{\ln \left ( \sin \left ( dx+c \right ) -1 \right ) aA}{4\,d \left ( a+b \right ) ^{3}}}-{\frac{3\,\ln \left ( \sin \left ( dx+c \right ) -1 \right ) Ab}{4\,d \left ( a+b \right ) ^{3}}}-{\frac{\ln \left ( \sin \left ( dx+c \right ) -1 \right ) Bb}{2\,d \left ( a+b \right ) ^{3}}}-{\frac{A}{4\,d \left ( a-b \right ) ^{2} \left ( 1+\sin \left ( dx+c \right ) \right ) }}+{\frac{B}{4\,d \left ( a-b \right ) ^{2} \left ( 1+\sin \left ( dx+c \right ) \right ) }}+{\frac{\ln \left ( 1+\sin \left ( dx+c \right ) \right ) aA}{4\,d \left ( a-b \right ) ^{3}}}-{\frac{3\,\ln \left ( 1+\sin \left ( dx+c \right ) \right ) Ab}{4\,d \left ( a-b \right ) ^{3}}}+{\frac{\ln \left ( 1+\sin \left ( dx+c \right ) \right ) Bb}{2\,d \left ( a-b \right ) ^{3}}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.00418, size = 467, normalized size = 2.05 \begin{align*} -\frac{\frac{4 \,{\left (3 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} \log \left (b \sin \left (d x + c\right ) + a\right )}{a^{6} - 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} - b^{6}} - \frac{{\left (A a -{\left (3 \, A - 2 \, B\right )} b\right )} \log \left (\sin \left (d x + c\right ) + 1\right )}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}} + \frac{{\left (A a +{\left (3 \, A + 2 \, B\right )} b\right )} \log \left (\sin \left (d x + c\right ) - 1\right )}{a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}} - \frac{2 \,{\left (B a^{3} - 2 \, A a^{2} b + 3 \, B a b^{2} - 2 \, A b^{3} +{\left (A a^{2} b - 4 \, B a b^{2} + 3 \, A b^{3}\right )} \sin \left (d x + c\right )^{2} +{\left (A a^{3} - B a^{2} b - A a b^{2} + B b^{3}\right )} \sin \left (d x + c\right )\right )}}{a^{5} - 2 \, a^{3} b^{2} + a b^{4} -{\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} \sin \left (d x + c\right )^{3} -{\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \sin \left (d x + c\right )^{2} +{\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} \sin \left (d x + c\right )}}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 7.8936, size = 1337, normalized size = 5.86 \begin{align*} \frac{2 \, B a^{5} - 2 \, A a^{4} b - 4 \, B a^{3} b^{2} + 4 \, A a^{2} b^{3} + 2 \, B a b^{4} - 2 \, A b^{5} - 2 \,{\left (A a^{4} b - 4 \, B a^{3} b^{2} + 2 \, A a^{2} b^{3} + 4 \, B a b^{4} - 3 \, A b^{5}\right )} \cos \left (d x + c\right )^{2} - 4 \,{\left ({\left (3 \, B a^{2} b^{3} - 4 \, A a b^{4} + B b^{5}\right )} \cos \left (d x + c\right )^{2} \sin \left (d x + c\right ) +{\left (3 \, B a^{3} b^{2} - 4 \, A a^{2} b^{3} + B a b^{4}\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (b \sin \left (d x + c\right ) + a\right ) +{\left ({\left (A a^{4} b + 2 \, B a^{3} b^{2} - 6 \,{\left (A - B\right )} a^{2} b^{3} - 2 \,{\left (4 \, A - 3 \, B\right )} a b^{4} -{\left (3 \, A - 2 \, B\right )} b^{5}\right )} \cos \left (d x + c\right )^{2} \sin \left (d x + c\right ) +{\left (A a^{5} + 2 \, B a^{4} b - 6 \,{\left (A - B\right )} a^{3} b^{2} - 2 \,{\left (4 \, A - 3 \, B\right )} a^{2} b^{3} -{\left (3 \, A - 2 \, B\right )} a b^{4}\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) -{\left ({\left (A a^{4} b + 2 \, B a^{3} b^{2} - 6 \,{\left (A + B\right )} a^{2} b^{3} + 2 \,{\left (4 \, A + 3 \, B\right )} a b^{4} -{\left (3 \, A + 2 \, B\right )} b^{5}\right )} \cos \left (d x + c\right )^{2} \sin \left (d x + c\right ) +{\left (A a^{5} + 2 \, B a^{4} b - 6 \,{\left (A + B\right )} a^{3} b^{2} + 2 \,{\left (4 \, A + 3 \, B\right )} a^{2} b^{3} -{\left (3 \, A + 2 \, B\right )} a b^{4}\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \,{\left (A a^{5} - B a^{4} b - 2 \, A a^{3} b^{2} + 2 \, B a^{2} b^{3} + A a b^{4} - B b^{5}\right )} \sin \left (d x + c\right )}{4 \,{\left ({\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d \cos \left (d x + c\right )^{2} \sin \left (d x + c\right ) +{\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d \cos \left (d x + c\right )^{2}\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.32555, size = 452, normalized size = 1.98 \begin{align*} -\frac{\frac{4 \,{\left (3 \, B a^{2} b^{3} - 4 \, A a b^{4} + B b^{5}\right )} \log \left ({\left | b \sin \left (d x + c\right ) + a \right |}\right )}{a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}} - \frac{{\left (A a - 3 \, A b + 2 \, B b\right )} \log \left ({\left | \sin \left (d x + c\right ) + 1 \right |}\right )}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}} + \frac{{\left (A a + 3 \, A b + 2 \, B b\right )} \log \left ({\left | -\sin \left (d x + c\right ) + 1 \right |}\right )}{a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}} + \frac{2 \,{\left (A a^{2} b \sin \left (d x + c\right )^{2} - 4 \, B a b^{2} \sin \left (d x + c\right )^{2} + 3 \, A b^{3} \sin \left (d x + c\right )^{2} + A a^{3} \sin \left (d x + c\right ) - B a^{2} b \sin \left (d x + c\right ) - A a b^{2} \sin \left (d x + c\right ) + B b^{3} \sin \left (d x + c\right ) + B a^{3} - 2 \, A a^{2} b + 3 \, B a b^{2} - 2 \, A b^{3}\right )}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )}{\left (b \sin \left (d x + c\right )^{3} + a \sin \left (d x + c\right )^{2} - b \sin \left (d x + c\right ) - a\right )}}}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]